package com.stylefeng.guns.modular.front.controller;

import com.stylefeng.guns.common.persistence.model.Division;
import com.stylefeng.guns.core.base.controller.FrontBaseController;
import com.stylefeng.guns.core.base.tips.SuccessTip;
import com.stylefeng.guns.modular.flagglory.service.IDivisionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: xinqi
 * Date: 2018/2/7
 * Time: 14:44
 */
@RestController
@RequestMapping("/front/division")
public class FrontDivisionController extends FrontBaseController {
    @Autowired
    private IDivisionService divisionService;

    @RequestMapping(value = "/getDivisionList", method = RequestMethod.GET)
    @ApiOperation("获取所有段位信息")
    public Object getDivisionList() {
        List<Division> divisions = divisionService.selectList(null);
        Map<String, Object> result = new HashMap<>();
        result.put("divisions", divisions);
        return new SuccessTip(result);
    }
}
